package com.library.utils
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.IBitmapDrawable;
	import flash.geom.Rectangle;
	
	public class BitmapConverter
	{
		// Function
		public static function convertToBmp(source:IBitmapDrawable, width:Number, height:Number):Bitmap{
        	var bmpData:BitmapData = new BitmapData(width, height, true, 0xe1e1e1);
			bmpData.draw(source);
			var bitmap:Bitmap = new Bitmap(bmpData);
			return bitmap;
        }
        
		public static function convertToBmp2(source:IBitmapDrawable, width:Number, height:Number, clipRect:Rectangle = null):BitmapData{
        	var bmpData:BitmapData = new BitmapData(width, height, true, 0xe1e1e1);
			bmpData.draw(source, null, null, null, clipRect);
			return bmpData;
        }
	}
}